\(\int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx\) [20]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 13, antiderivative size = 24 \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )}{\sqrt {a}} \]

[Out]

2*arctanh((a+b*cos(x))^(1/2)/a^(1/2))/a^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {2800, 65, 213} \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )}{\sqrt {a}} \]

[In]

Int[Tan[x]/Sqrt[a + b*Cos[x]],x]

[Out]

(2*ArcTanh[Sqrt[a + b*Cos[x]]/Sqrt[a]])/Sqrt[a]

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 2800

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[(x^p*(a + x)^m)/(b^2 - x^2)^((p + 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2
 - b^2, 0] && IntegerQ[(p + 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{x \sqrt {a+x}} \, dx,x,b \cos (x)\right ) \\ & = -\left (2 \text {Subst}\left (\int \frac {1}{-a+x^2} \, dx,x,\sqrt {a+b \cos (x)}\right )\right ) \\ & = \frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )}{\sqrt {a}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\frac {2 \text {arctanh}\left (\frac {\sqrt {a+b \cos (x)}}{\sqrt {a}}\right )}{\sqrt {a}} \]

[In]

Integrate[Tan[x]/Sqrt[a + b*Cos[x]],x]

[Out]

(2*ArcTanh[Sqrt[a + b*Cos[x]]/Sqrt[a]])/Sqrt[a]

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(102\) vs. \(2(18)=36\).

Time = 1.71 (sec) , antiderivative size = 103, normalized size of antiderivative = 4.29

method result size
default \(\frac {\ln \left (\frac {4 \cos \left (\frac {x}{2}\right ) b \sqrt {2}+4 \sqrt {a}\, \sqrt {-2 b \left (\sin ^{2}\left (\frac {x}{2}\right )\right )+a +b}+4 a -4 b}{2 \cos \left (\frac {x}{2}\right )-\sqrt {2}}\right )+\ln \left (-\frac {4 \left (\cos \left (\frac {x}{2}\right ) b \sqrt {2}-\sqrt {a}\, \sqrt {-2 b \left (\sin ^{2}\left (\frac {x}{2}\right )\right )+a +b}-a +b \right )}{2 \cos \left (\frac {x}{2}\right )+\sqrt {2}}\right )}{\sqrt {a}}\) \(103\)

[In]

int(tan(x)/(a+cos(x)*b)^(1/2),x,method=_RETURNVERBOSE)

[Out]

(ln(4/(2*cos(1/2*x)-2^(1/2))*(cos(1/2*x)*b*2^(1/2)+a^(1/2)*(-2*b*sin(1/2*x)^2+a+b)^(1/2)+a-b))+ln(-4/(2*cos(1/
2*x)+2^(1/2))*(cos(1/2*x)*b*2^(1/2)-a^(1/2)*(-2*b*sin(1/2*x)^2+a+b)^(1/2)-a+b)))/a^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 45 vs. \(2 (18) = 36\).

Time = 0.29 (sec) , antiderivative size = 98, normalized size of antiderivative = 4.08 \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\left [\frac {\log \left (\frac {b^{2} \cos \left (x\right )^{2} + 8 \, a b \cos \left (x\right ) + 4 \, {\left (b \cos \left (x\right ) + 2 \, a\right )} \sqrt {b \cos \left (x\right ) + a} \sqrt {a} + 8 \, a^{2}}{\cos \left (x\right )^{2}}\right )}{2 \, \sqrt {a}}, -\frac {\sqrt {-a} \arctan \left (\frac {{\left (b \cos \left (x\right ) + 2 \, a\right )} \sqrt {b \cos \left (x\right ) + a} \sqrt {-a}}{2 \, {\left (a b \cos \left (x\right ) + a^{2}\right )}}\right )}{a}\right ] \]

[In]

integrate(tan(x)/(a+b*cos(x))^(1/2),x, algorithm="fricas")

[Out]

[1/2*log((b^2*cos(x)^2 + 8*a*b*cos(x) + 4*(b*cos(x) + 2*a)*sqrt(b*cos(x) + a)*sqrt(a) + 8*a^2)/cos(x)^2)/sqrt(
a), -sqrt(-a)*arctan(1/2*(b*cos(x) + 2*a)*sqrt(b*cos(x) + a)*sqrt(-a)/(a*b*cos(x) + a^2))/a]

Sympy [F]

\[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\int \frac {\tan {\left (x \right )}}{\sqrt {a + b \cos {\left (x \right )}}}\, dx \]

[In]

integrate(tan(x)/(a+b*cos(x))**(1/2),x)

[Out]

Integral(tan(x)/sqrt(a + b*cos(x)), x)

Maxima [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.46 \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=-\frac {\log \left (\frac {\sqrt {b \cos \left (x\right ) + a} - \sqrt {a}}{\sqrt {b \cos \left (x\right ) + a} + \sqrt {a}}\right )}{\sqrt {a}} \]

[In]

integrate(tan(x)/(a+b*cos(x))^(1/2),x, algorithm="maxima")

[Out]

-log((sqrt(b*cos(x) + a) - sqrt(a))/(sqrt(b*cos(x) + a) + sqrt(a)))/sqrt(a)

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 22, normalized size of antiderivative = 0.92 \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=-\frac {2 \, \arctan \left (\frac {\sqrt {b \cos \left (x\right ) + a}}{\sqrt {-a}}\right )}{\sqrt {-a}} \]

[In]

integrate(tan(x)/(a+b*cos(x))^(1/2),x, algorithm="giac")

[Out]

-2*arctan(sqrt(b*cos(x) + a)/sqrt(-a))/sqrt(-a)

Mupad [F(-1)]

Timed out. \[ \int \frac {\tan (x)}{\sqrt {a+b \cos (x)}} \, dx=\int \frac {\mathrm {tan}\left (x\right )}{\sqrt {a+b\,\cos \left (x\right )}} \,d x \]

[In]

int(tan(x)/(a + b*cos(x))^(1/2),x)

[Out]

int(tan(x)/(a + b*cos(x))^(1/2), x)